package com.nhim.cms.admin.server.locator;

import com.google.web.bindery.requestfactory.shared.Locator;
import com.nhim.cms.dao.GroupDAO;
import com.nhim.cms.dao.IGroupDAO;
import com.nhim.cms.domain.Group;

public class GroupLocator extends Locator<Group, Integer> {

	IGroupDAO groupDAO = GroupDAO.getInstance();
	@Override
	public Group create(Class<? extends Group> domain) {
		return new Group();
	}

	@Override
	public Group find(Class<? extends Group> domain, Integer id) {
		if (id == null)
			return new Group();
		return groupDAO.findById(id);
	}

	@Override
	public Class<Group> getDomainType() {
		return Group.class;
	}

	@Override
	public Integer getId(Group domain) {
		return domain.getId();
	}

	@Override
	public Class<Integer> getIdType() {
		return Integer.class;
	}

	@Override
	public Object getVersion(Group domain) {
	return domain.getVersion();
	}

}
